/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.orhandemirel.jabif;

/**
 *
 * @author Selcuk Orhan DEMIREL <orhandemirel@msn.com>
 */
public class AbifTag {

    public enum TagType
    {
        CHAR,
        INT,
        FLOAT,
        DOUBLE,
        DATE,
        TIME,
        STRING,
        UNSUPPORTED;
    }

    public static class Date
    {
        private int year;
        private int month;
        private int day;

        public Date(int year, int month, int day)
        {
            this.year = year;
            this.month = month;
            this.day = day;
        }

        /**
         * @return the year
         */
        public int getYear() {
            return year;
        }

        /**
         * @return the month
         */
        public int getMonth() {
            return month;
        }

        /**
         * @return the day
         */
        public int getDay() {
            return day;
        }  
    }

    
    public static class Time
    {
        private int hour;
        private int minute;
        private int second;
        private int hsecond;

        public Time(int hour, int minute, int second, int hsecond)
        {
            this.hour = hour;
            this.minute = minute;
            this.second = second;
            this.hsecond = hsecond;
        }
        /**
         * @return the hour
         */
        public int getHour() {
            return hour;
        }

        /**
         * @return the minute
         */
        public int getMinute() {
            return minute;
        }

        /**
         * @return the second
         */
        public int getSecond() {
            return second;
        }

        /**
         * @return the hsecond
         */
        public int getHsecond() {
            return hsecond;
        }
        
    }

    private TagType type;   // type of the data

    private String id;  // id equals name+number of dirEntry

    private Object[] data;  // data stored in the tag
    
    private DirEntry dirEntry;  // underlying dirEntry

    public AbifTag(DirEntry dirEntry, Object[] data, AbifTag.TagType type)
    {
        this.dirEntry = dirEntry;
        this.data = data;
        this.type = type;
        this.id = this.dirEntry.getName() + Integer.toString( this.dirEntry.getNumber() );
    }

    /**
     * @return the type
     */
    public TagType getType() {
        return type;
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @return the data
     */
    public Object[] getData() {
        return data;
    }

    /**
     * @return the dirEntry
     */
    public DirEntry getDirEntry() {
        return dirEntry;
    }
    
}
